<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in" ref="dialogBox">
      <div class="cornerComment-in-title">
        <span>{{ `${dataOption.realname}-${dataOption.name}` }}</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <component
            v-if="isShow"
            v-bind:is="propertytype"
            :pageindex="page.pageindex"
            @pagtotal="pagtotal"
            :property.sync="dataOptionPush"
        ></component>
        <el-col :span="24" class="toolbar">
          <el-pagination
              background
              layout="total,prev, pager, next"
              :total="page.total"
              :page-size="page.pagesize"
              @current-change="handleSizeChange">
          </el-pagination>
        </el-col>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="closePOpup" size="small">返回</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {noteList} from "@/api/admin/outineWorke"
import {pagination} from '@/utils/util.js'
import style0 from "./style0"; // 例行工作
import style1 from "./style1"; // 巡班
import style2 from "./style2"; // 行政陪餐
import style3 from "./style3"; // 拟发通知
import style4 from "./style4"; // 拟发问卷
import style5 from "./style5"; // 档案审阅
import style6 from "./style6"; // 档案任务
import style7 from "./style7"; // 执行公文

export default {
  props: ['visible', 'dataOption'], // commoent 学生点评 collection 学生采集
  components: {
    style0,
    style1,
    style2,
    style3,
    style4,
    style5,
    style6,
    style7
  },
  data() {
    return {
      currentview: false, // propertytype: "companyProperty",
      // content: {
      //   label: "公司简介",
      //   body: '公司简介详细内容'
      // }
      propertytype: '',
      dialogVisible: false,
      editStatus: true,
      arryList: [],
      content: null,
      // 设置table页面分页所需
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
      dataOptionPush: null,
      isShow: false
    }
  },
  watch: {
    visible() {
      let n = this;
      this.dialogVisible = this.visible
      console.log('dataOption:', this.dataOption)
      if (this.visible) {
        this.propertytype = `style${this.dataOption.style}`;
        this.$nextTick(() => {
          let height = n.$refs.dialogBox.offsetHeight;  //top 50 1 search 50 page 50 10 footer 50 1
          n.dataOptionPush = JSON.parse(JSON.stringify(n.dataOption))
          n.dataOptionPush.tableHeight = height - (51 + 50 + 40 + 51)
          n.isShow = true
        })
      } else {
        n.isShow = false
        this.page = {
          pageindex: pagination.pageIndex,
          pagesize: pagination.pageSize,
          total: pagination.total
        }
      }
    }
  },
  created() {
  },
  methods: {
    handleSizeChange(val) {
      this.page.pageindex = val
    },
    // 获取记录
    getFileListFn() {
      noteList({p: 1, cate_id: this.workId, user_id: this.userListData.id}).then(res => {
        for (let item of res.list.data) {
          item.file = JSON.parse(item.file)
        }
        this.arryList = res.list.data
        this.page.total = res.list.total
      })
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    pagtotal(option){
      this.page.total = option
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 80%;
  height: 600px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 20px 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.hearder-search {
  display: flex;
  align-items: center;
}
</style>


